/* name: edge
 * author: 5ab
 * created at: 2024-06-11
 */
#include <bits/stdc++.h>
using namespace std;

#define all(x) (x).begin(), (x).end()
#define ssz(x) (int((x).size()))

auto chmax = [](auto& x, auto y) { if (x < y) x = y; };
auto chmin = [](auto& x, auto y) { if (y < x) x = y; };

using ll = long long;
const int N = 1.5e5, M = 3e5, ND = N * 2, E = M * 6;
const ll INF = 1e18;

int hd[ND], des[E], nxt[E], val[E], ec = 0;
ll dis[ND];
bool vis[ND];

void add(int s, int t, int v)
{
	des[ec] = t;
	val[ec] = v;
	nxt[ec] = hd[s];
	hd[s] = ec++;
}

priority_queue<pair<ll, int>, vector<pair<ll, int>>, greater<>> q;
signed main()
{
	freopen("edge.in", "r", stdin);
	freopen("edge.out", "w", stdout);
	
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	
	int n, m, a, b;
	
	cin >> n >> m >> a >> b;
	fill(hd, hd + 2 * n, -1);
	
	for (int i = 0, x, y; i < m; i++)
	{
		cin >> x >> y, x--, y--;
		add(x, y, a), add(y, x, a);
		add(x, y + n, 0), add(y + n, x, b);
		add(y, x + n, 0), add(x + n, y, b);
	}
	
	fill(dis, dis + 2 * n, INF);
	q.emplace(dis[0] = 0, 0);
	
	while (!q.empty())
	{
		auto [_, x] = q.top(); q.pop();
		if (vis[x])
			continue;
		vis[x] = 1;
		for (int p = hd[x], dst; p != -1; p = nxt[p])
		{
			dst = des[p];
			if (dis[dst] > dis[x] + val[p])
			{
				dis[dst] = dis[x] + val[p];
				q.emplace(dis[dst], dst);
			}
		}
	}
	for (int i = 1; i < n; i++)
		cout << dis[i] << "\n";
	
	return 0;
}
// started coding at: 06-11 09:06:24